# -*- encoding: utf-8 -*-
'''
@File    :   8.py
@Time    :   2022/10/25 20:52:34
@Author  :   Cms 
@Version :   1.0
@Contact :   2267000140@qq.com
@WebSite    :   www.baidu.com
'''

# here put the import lib

import operator
# 8 设计一个数据结构，用来存放10个员工的信息并初始化，
#  每个员工信息包括：工号，姓名，工龄，工资；  将这10个员工，按照工资从高到低打印输出；

# 设计一个员工的类
class employee():
    def __init__(self, ID, name, age, wage):
        self.ID = ID
        self.name = name
        self.age = age
        self.wage = wage

    def __lt__(self, other):
        if self.wage > other.wage:
            return True
        else:
            return False


e1, e2, e3 = employee(1, "chen", 18, 1000), employee(
    2, "ming", 20, 4000), employee(3, "shang", 21, 3000)

e4, e5, e6 = employee(4, "c", 28, 6000), employee(
    5, "ng", 27, 8000), employee(6, "shg", 29, 10000)

e7, e8, e9 = employee(7, "hen", 18, 9000), employee(
    8, "ing", 21, 4500), employee(9, "hang", 21, 23000)

e10 = employee(10, "N", 19, 5000)

comfun = operator.attrgetter("wage")

l = [e1, e2, e3, e4, e5, e6, e7, e8, e9, e10]
l.sort(key=comfun)
l.reverse()

for i in l:
    print(i.ID, i.name, i.age, i.wage)
